local get_python_path = function()
  local venv = os.getenv("VIRTUAL_ENV")
  if venv then
    return venv .. "/bin/python"
  end
  return "python3" -- 默认回退
end

require("lspconfig").pyright.setup({
  before_init = function(_, config)
    config.settings.python.pythonPath = get_python_path()
  end,
})